Repository navigation
fix(audit): a search the server widens never names a column the caller may not query - #34817
Conversation
…r may not query The server-chosen search set of an object leaves out every column the object's own query guard would refuse this caller, as it already leaves out a field the caller may not query (#25672). A column the caller names itself is judged by the guard as before. - ObjectQL#registerSearchFieldWithholder: the seam an object's own guard uses to name those columns. - plugin-audit registers one for sys_audit_log and sys_activity, answered by the guard's own rule; the system-context census row owns it. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ADHkmRPxhTmqbUbMrqygh4
|
repo:objectstack#2 · os-steve · session_01ADHkmRPxhTmqbUbMrqygh4 2026-11-17T11:32Z Final head for review: Generated by Claude Code |
📓 Docs Drift CheckThis PR changes 2 package(s): 8 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 30 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a0725ff6e70602d4f2b98b0cb16d92b11942da0b && git checkout a0725ff6e70602d4f2b98b0cb16d92b11942da0b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8f141a28dc6f179ad10dfe018e0cf0c93346d0c3 81705ebb1af2e8f1140f30df8d87d467e0f8e6a7 && git checkout -B drift-repro 8f141a28dc6f179ad10dfe018e0cf0c93346d0c3 && git merge --no-ff 81705ebb1af2e8f1140f30df8d87d467e0f8e6a7
node scripts/docs-audit/affected-docs.mjs --json 8f141a28dc6f179ad10dfe018e0cf0c93346d0c3
|
|
repo:objectstack#2 · os-steve · session_01ADHkmTPcB6fZEwhd2hNQwC 席位核对L1 verdict: ACCEPT · PR #34817 · card #34700 (server half, list search only, per 6943935258 / ruling 6946587690) · first review · L1-c2 of seat repo:objectstack#2 Head-sha: Read from GitHub and the diff at this head, not from the report. 13 files, +478/−50. This review stays at the rule level, as the card's ruling asks. Shape
Rule checked against the code: a search set the server chooses leaves out every column the object's own query guard would refuse this caller, as #25672 already does for fields the security service withholds. A column the caller names in
Pins
Docs: the Gates: 55 check-runs on this head, all L2 owed: no. None of the four contract faces is touched: Landing tier: NOT governed (0 of 13 paths), +478/−50 = 528 lines ≤ 3000, no spec face, no narrowing. The area lands it (ordinary queue landing). The card is |
|
repo:objectstack#2 · os-steve · session_01ADHkmRPxhTmqbUbMrqygh4 2026-11-17T11:55Z Landing Generated by Claude Code |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 44078624886 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
…rule Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ADHkmRPxhTmqbUbMrqygh4
One conflict, packages/plugins/plugin-audit/src/parent-field-query-guard.ts: main passes the caller to parentFieldQueryRefusal (the refusal's userMessage); this branch moved the middleware's verdict into guardRefuses. Resolved as the guardRefuses call with main's caller argument. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QSeKYmQuAhLgegkqRcTc38
…rch-field withholder in its own registration The merge with main put engine.ts over its facade line ceiling (6880 against 6857), and a facade file does not grow. The withholder is no longer a method on the engine: registerMiddleware takes EngineMiddlewareOptions, whose withholdSearchFields the search expansion asks for the reads that middleware runs on (the same object selector). The entry type lives in engine-top-level.ts, so engine.ts ends at 6856. plugin-audit's two guards declare theirs in the registration they already make. Behaviour is unchanged; one pin added for a middleware that runs for every object. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QSeKYmQuAhLgegkqRcTc38
…om where it is declared Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QSeKYmQuAhLgegkqRcTc38
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — L1 REWORK · head
|
…nvelope and the refusal words The ledger pin for a search naming old_value now asserts the nested error code PERMISSION_DENIED beside the 403. The activity-stream pin for a search naming summary asserts through the file's own expectRefused, so the refusal's first sentence is pinned too. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QSeKYmQuAhLgegkqRcTc38
…oute answers it Measured on the real boot: GET /data/sys_audit_log answers the refusal with the message in error and the code at the top level of the body. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QSeKYmQuAhLgegkqRcTc38
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — ACCEPT · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Landing · 2026-11-24T09:55Z · head
|
| Probe | Reading |
|---|---|
check-governed-merges.mjs --pr 34817 |
NOT governed — 0 of 14 paths; 583 changed lines ≤ 3000 |
landing-k.mjs --pr 34817 |
OK — K = 7 < 15 on origin/main 4f19091997; no shared book or locale pack moved |
pr-state.mjs --pr 34817 |
40 success · 15 expected skip · 0 failed · 0 pending · mergeable_state clean |
| os-regen drift | 0 — none of the 14 paths is on .gitattributes' merge=os-regen list |
State: L1 ACCEPT at this head (seat comment on this PR); the HELD condition is lifted by the maintainer's ruling A on #34700 (comment 7128046786). pr_ready + auto-merge now; the seat follows it to MERGED and closes out #34700 there.
Requested by Steve · project thread
Fixes #34700
Clause-②: no
Metadata-protocol: none
Skills-docs: none — no skill or docs page teaches this search set.
Scope: item ① of the card, the server-side list search: the auditor's audit-log search no longer turns the list into 403. The card's other items have landed elsewhere: item ② in PR #34880 (merged
c41b6ca286), the ui half in PR #35389 (via #34741). SoFixes #34700closes the card once this lands. Continued by seat repo:objectstack#4 from12455d5acc(claim 7121652462).维护者速读
old_value/new_value快照列、活动流的值列),和 REST search on sys_user answers 403 for non-admin members (search expands to hidden role / ban_reason / last_login_ip) — every user picker breaks when typing #25672 对「调用者不能查询的字段」的处理一致。调用者在searchFields里自己点名的列不扣,照旧由守卫拒绝。engine.ts超出门面行数上限,所以接口从引擎上的新方法改为registerMiddleware的选项withholdSearchFields(守卫中间件在注册时自带),行为不变。回滚即还原本 PR。packages/plugins/plugin-audit/src/parent-field-query-guard.ts的withheldSearchColumns与注册处;packages/objectql/src/engine-find.ts的resolveSearchWithheldFields;packages/qa/dogfood/test/activity-text-predicate.dogfood.test.ts那条改过的钉。pnpm --filter @objectstack/objectql exec vitest run src/engine-search-field-withholder.test.ts,预期 11 条全绿。summary的搜索仍拒(403)」。该确认此前已请求、尚无记录。What changes
packages/objectql:registerMiddleware(fn, options)takesEngineMiddlewareOptions(declared inengine-top-level.ts, exported from the package). Its newwithholdSearchFieldsis a guard middleware's search-field withholder. Before a non-blanksearchis expanded, the withholders of the middlewares that run for the object (the same object selectorexecuteWithMiddlewareapplies) name fields to leave out of the server-resolved set, beside thegetQueryableFieldsanswer (search-filter.tswithheldFields). A field the caller names insearchFieldsis kept. Context-less reads and blank terms ask nothing. A set left empty is the existing400 INVALID_FIELD. A throw propagates.packages/plugins/plugin-audit/src/parent-field-query-guard.ts: the guard's verdict is one function (guardRefuses), shared by the middleware and its withholder (withheldSearchColumns), so the two answer the same rule. Each guard declares its withholder in the registration it already makes. An engine that does not read the option keeps the guard alone, as before.content/docs/permissions/system-context.mdx: census row 45 ownswithheldSearchColumns.Delta since the last reviewed head
54107ea2ac(L1-c2 ACCEPT 6947307277)12455d5acc(unreviewed until now): the dogfood pin inactivity-text-predicate.dogfood.test.tsfollows the rule. Before, onmain: for a stored value and a non-matching value,$search=VALUEonsys_activityanswers403 PERMISSION_DENIED. After:$search=VALUEanswers200, the matching and the non-matching probe give the same{ status, rows }, and$search=VALUE&$searchFields=summaryanswers403 PERMISSION_DENIED. The merge leaves this pin as it is in12455d5acc(main did not touch the file).9fa0bb95b, merge oforigin/mainf46ce5b4a: one conflict inparent-field-query-guard.ts. Main passes the caller toparentFieldQueryRefusal(itsuserMessage). It is resolved as theguardRefusescall with main's caller argument.6dcdf177c+18bafcac5: after the merge,engine.tswas 6880 lines, above its facade ceiling of 6857 (scripts/facade-delegation-registry.json, ruling 7051956587; main sits at 6857). The seam moved off the facade: the withholder is now the middleware's own option, not the methodObjectQL#registerSearchFieldWithholder. The entry type lives inengine-top-level.ts.engine.tsends at 6856 lines and the gate is green. Behaviour is unchanged. One pin is added: a withholder on a middleware for every object (no object, or'*') is asked for each object.Tests
packages/objectql/src/engine-search-field-withholder.test.ts: the seam's contract onfind/findOne/count. It covers what is asked, a named field kept, nothing withheld, context-less and blank searches, another object's withholder not asked, an every-object withholder asked, an emptied set answering400 INVALID_FIELD, and a throw propagating.plugin-auditaudit-log-predicate-guard.test.tsandactivity-predicate-guard.test.ts: both objects, pinned and unpinned, pluscount. A search naming a guarded column is still refused.audit-log-audit-capability.dogfood.test.ts(the HTTP door for the holder, the read-only member and the admin control) andactivity-text-predicate.dogfood.test.ts(the pin in item 1 above).Acceptance notes
54107ea2aconly. This head needs its own review.engine.tsceiling was the alternative to moving the seam. That needs a maintainer ruling, so it was not taken.Verification
All at head
18bafcac5, after the merge, with the closure built (pnpm --filter '@objectstack/dogfood^...' build, exit 0).Suites under the lock
src/engine-search*,src/search-filter*,src/engine-middleware*): 6 files / 70 tests.activity-text-predicate+audit-log-audit-capability: 2 files / 39 tests.check:test-typecheck): exit 0.Derived gates
dispatch-gates.mjs --ran: 109 derived, 109 run, 0 NOT-MEASURED, with an exit code recorded for each of the 109 and all of them 0. That includescheck:facade-delegation-only, which was red before the seam moved.check-nul-bytesandcheck-platform-checklist --changed-from origin/mainboth exit 0.Ablation of the moved wiring
Mutation: the
withholdSearchFieldsline in plugin-audit's guard registration was removed withablation-replace.mjs. plugin-audit was rebuilt, andablation-dist-preflight --absentconfirmed the line was gone from dist. Result: 6 red in the plugin-audit search cases and 4 red in dogfood (the activity pin in three reader classes, plus the audit-log holder case). The named-column refusals stayed green.Restore: the blob is back to the HEAD blob and
git diff HEADis empty. plugin-audit was rebuilt and the preflight confirmed the marker is absent. Result: 76/76 and 39/39 green.Full dogfood battery: not run. The title carries no
!andClause-②has no narrowing arm. CI's Dogfood Regression Gate is the reading of record.